Using sscanf for the dynamic delimiters (inputted by users) in parsing an input string in C? [migrated]

Posted by Zuhakasa on Programmers See other posts from Programmers or by Zuhakasa
Published on 2011-11-16T23:43:38Z Indexed on 2011/11/17 2:03 UTC
Read the original article Hit count: 136

Filed under:
|

I'm encountering a problem in parsing a string using sscanf() function.

My function gets 2 string parameters. One for input string and another one for a dynamic list of delimiters. How can I use sscanf to parse the input string with the defined delimiters inputted by users.

For example:

Myfunction(char * input_string, char * delimiter_list){
    scanf("%s", input_string);
    scanf("%s", delimiter_list);
    sscanf(input_string, ???...);
    ................
}

© Programmers or respective owner

Related posts about c++

Related posts about c